//
//  JobsListService.swift
//  ezyform
//
//  Created by FengMoennig on 12/28/15.
//  Copyright © 2015 Client.Solution Pty Ltd. All rights reserved.
//

import UIKit
import Alamofire
import SwiftyJSON
import HandyJSON
class JobsListService: BaseService {
    
    func getInstallationsListForV2(_ queryStr: String = "",cacheFlag: Bool = true){
        
        var url : String = APIConfig.getRequestAPIForV2(APIConfig.InstallationsListAPI) + queryStr
        //将原始的 url 编码为合法的 url
        url = url.addingPercentEncoding(withAllowedCharacters: CharacterSet.urlQueryAllowed)!
        let alRequest = ALRequest.init(mainURL: url, method: .get, headers: RequestConstant.AuthTokenParam, paramDict: nil, successBlock: { (result, otherInfo) -> Void in
            
           self.returnBlock(result,otherInfo)
        
        }) {(code, obj) -> Void in
            self.errorBlock?(code, obj)
        }
        alRequest.startRequest(cacheFlag: cacheFlag)
        
    }
    
//    func getAllJobsForV2(){
//        
//        let url : String = APIConfig.getRequestAPIForV2(APIConfig.GetAllPVDJobsForCurrentUser)
//        
//        let alRequest = ALRequest.init(mainURL: url, method: .get, headers: RequestConstant.AuthTokenParam, paramDict: nil, successBlock: {  (jsonStr, _) -> Void in
//            self.returnBlock(jsonStr,nil)
//        }) {(code, obj) -> Void in
//            self.errorBlock?(code, obj)
//        }
//        alRequest.startRequest()
//    }
}
